package com.szzg10.thinking.chapter11;

import java.util.ArrayList;
import java.util.List;

public class ApplesAndOrangesWithGenerics {

	public static void main(String[] args) {
		List<Apple> apples = new ArrayList<Apple>();
		for(int i = 0; i < 3; i++) {
			apples.add(new Apple());
		}
		
		for(Apple element: apples) {
			System.out.println(element.getId());
		}
	}
}

class Apple {
	private static int count = 0;
	
	private int id;
	
	public Apple() {
		id = count++;
	}
	
	public int getId() {
		return id;
	}
}